package com.svse.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.svse.dao.UserinfoDAO;
import com.svse.service.UserinfoService;
import com.svse.vo.Userinfo;

@Service("userinfoService")
public class UserinfoServiceImpl implements UserinfoService {
	@Autowired
	private UserinfoDAO userinfoDAO;
	
	public UserinfoDAO getUserinfoDAO() {
		return userinfoDAO;
	}

	public void setUserinfoDAO(UserinfoDAO userinfoDAO) {
		this.userinfoDAO = userinfoDAO;
	}

	public Userinfo findByUnameAndUpwd(String uname, String upwd) {
		List<Userinfo> lu = userinfoDAO.findByUname(uname);
		if(lu.size()<1){
			return null;
		}
		Userinfo userinfo = lu.get(0);
		return userinfo.getUpwd().equals(upwd)?userinfo:null;
	}

}
